//
//  ChartingModel.m
//  intelligent
//
//  Created by 甘世清 on 2024/3/1.
//

#import "ChartingModel.h"
#import "HotModel.h"
@implementation ChartingModel
+(NSArray*)SQ_setUpModel:(NSDictionary*)data{
    NSMutableArray * array = [[NSMutableArray alloc]init];
     ChartingModel * model1 = [ChartingModel new];
    model1.height =  130;
    model1.size = CGSizeMake(88, 117);
    model1.identifier = @"ChartingTop1CollectionViewCell";
    model1.name = SQNSLocalString(@"热门展示");
    model1.jsonArray = [[NSMutableArray alloc]init];
    [model1.jsonArray addObjectsFromArray:[HotModel mj_objectArrayWithKeyValuesArray:[data objectForKey:@"hots"]]];

    ChartingModel * model2 = [ChartingModel new];
    model2.height =  50;
    model2.size = CGSizeMake(64, 32);
    model2.identifier = @"ChartingTop2CollectionViewCell";
    model2.name = SQNSLocalString(@"选择风格");
    model2.jsonArray = [[NSMutableArray alloc]init];
    [model2.jsonArray addObjectsFromArray:[HotModel mj_objectArrayWithKeyValuesArray:[data objectForKey:@"styleList"]]];
    if (model2.jsonArray.count >0) {
        HotModel * model = model2.jsonArray.firstObject;
        model.isSeleted = YES;
    }
    ChartingModel * model3 = [ChartingModel new];
    model3.height =  140;
    model3.size = CGSizeMake(88, 130);
    model3.jsonArray = [[NSMutableArray alloc]init];
    model3.identifier = @"ChartingTop3CollectionViewCell";
    if (model2.jsonArray.count >0) {
        HotModel * model22 = model2.jsonArray.firstObject;
        [model3.jsonArray addObjectsFromArray:[HotModel mj_objectArrayWithKeyValuesArray:model22.styles]];
        HotModel * model = model3.jsonArray.firstObject;
        model.isSeleted = YES;
    }
    ChartingModel * model4 = [ChartingModel new];
    model4.height =  130;
    model4.size = CGSizeMake(88, 117);
    model4.identifier = @"ChartingTop4CollectionViewCell";
    model4.name = SQNSLocalString(@"选择比例");
    model4.jsonArray = [[NSMutableArray alloc]init];
    [model4.jsonArray addObjectsFromArray:[HotModel mj_objectArrayWithKeyValuesArray:[data objectForKey:@"sizeList"]]];
    if (model4.jsonArray.count >0) {
        HotModel * model = model4.jsonArray.firstObject;
        model.isSeleted = YES;
    }
    [array addObject:model1];
    [array addObject:model2];
    [array addObject:model3];
    [array addObject:model4];
    
    return  array;
}
@end
